# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=rustcat
_binname=rcat
pkgver=v3.0.0.r4.g245c791
pkgrel=1
pkgdesc='A modern port listener and reverse shell.'
groups=('blackarch' 'blackarch-networking')
arch=('x86_64' 'aarch64')
url='https://github.com/robiot/rustcat'
license=('MIT')
makedepends=('cargo' 'git')
sha512sums=('SKIP')
source=("git+https://github.com/robiot/$pkgname.git")

pkgver() {
  cd $pkgname

  echo $(git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
}

build() {
  cd $pkgname

  cargo build --release
}

package() {
  cd $pkgname

  install -Dm 755 "target/release/$_binname" "$pkgdir/usr/bin/$_binname"
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

